home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Random2.0 / RandomPlot / ElkinsEngine.h next >
Text File  |  1995-06-12  |  1KB  |  63 lines

  1. //
  2. // ElkinsEngine
  3. //
  4. // This is an Objective-C class which uses
  5. // the Random architecture from
  6. // Contemporary Design Studios.
  7. //
  8. // The ElkinsEngine class implements a random number generator with a cycle
  9. // length of 8.8 trillion.
  10. // 
  11. // Upon creation of an ElkinsEngine, the seeds are set using the system clock.
  12. // Three calls are made to the system clock function, and for each the 
  13. // microseconds are used as the seed value. Thus, the relationships between
  14. // the seeds are dependant upon system load.
  15. //
  16. // The algorithm used by the ElkinsEngine class is that given in the article:
  17. //   "A Higly Random Random-Number Generator" by T.A. Elkins
  18. //   Computer Language, 1989 December (Volume 6, Number 12), Page 59.
  19. //   Published by:
  20. //        Miller Freeman Publications
  21. //        500 Howard Street
  22. //        San Francisco, CA 94105
  23. //        415-397-1881
  24. //
  25. // Copyright (C) 1992 Contemporary Design Studios. All rights reserved.
  26. //
  27.  
  28.  
  29. #import "RandomEngine.h"
  30.  
  31.  
  32. @interface ElkinsEngine : RandomEngine
  33.  
  34.  
  35. {
  36.     ushort    h1, h2, h3;        // Seeds.
  37. }
  38.  
  39.  
  40. + (ulong)unit;
  41.  
  42. - init;
  43. - initSeeds:(ushort)s1            // Init with seeds given.
  44.   :(ushort)s2
  45.   :(ushort)s3;
  46.  
  47. - newSeeds;                // Get seeds from system time.
  48. - setSeeds:(ushort) s1            // Set seeds to those given.
  49.   :(ushort) s2
  50.   :(ushort) s3;
  51. - getSeeds:(ushort *)s1            // Put the seeds into some vars.
  52.   :(ushort *)s2
  53.   :(ushort *)s3;
  54.  
  55. - makeRandom:(uchar *)storage;
  56.  
  57.  
  58. @end
  59.  
  60.  
  61. //
  62. // End of file.
  63. //